//
//  Seach_FiltrateBrand_CellWX.m
//  ZITHER
//
//  Created by weixin on 2019/3/20.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "Seach_FiltrateBrand_CellWX.h"
#import "searchConditionsModel.h"

@implementation Seach_FiltrateBrand_CellWX

- (void)awakeFromNib {
    [super awakeFromNib];
 
    
    // Initialization code
}

-(void)funcRefloadCell{
    for (int i = 0; i<3; i++) {
        self.arrBtn[i].hidden = YES;
    }

    NSInteger index=self.indexPath.row ;
    NSLog(@"");
    index = (self.indexPath.row)*3;
    
    for (int i =0; i<3; i++) {
        NSArray *arr = kUSER_Filtrate_MANAGER.arrAttribute[0].child[self.indexPath.section].data;
        //        NSLog(@"index = %ld 总数%ld,",index+i,arr.count);
        if (arr.count<=index+i) {
            NSLog(@"超过了 index = %ld 总数%ld,",index+i,arr.count);
            
            break;
        }
        NSLog(@"index = %ld 总数%ld,",index+i,arr.count);
        
        //        NSLog(@"index = %ld 总数%ld,",index+i,arr.count);
        Seach_FiltrateAttributeSubData_Model_WX *model = arr[index+i];
        model.indexPath = self.indexPath;
        [self.arrBtn[i] setTitle:model.labelName forState:UIControlStateNormal];
        self.arrBtn[i].hidden = NO;
        
        [self.arrBtn[i] changBtnisSelect:model.isSelect];
    }
}


-(NSMutableArray<Seach_FiltrateBrand_Btn_WX *> *)arrBtn{
    if (!_arrBtn) {
        _arrBtn = [[NSMutableArray alloc]init];
        for (int i =0; i<3; i++) {
            Seach_FiltrateBrand_Btn_WX *btn = [[Seach_FiltrateBrand_Btn_WX alloc]init];
            [btn setTitle:@"劳力士" forState:UIControlStateNormal];
            [btn setTitleColor:HexColor(0x333333) forState:UIControlStateNormal];
            btn.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:13];
            btn.frame = CGRectMake(i*((kScreenW-50)/3.0+10)+15, 0, (kScreenW-50)/3.0, 35);
            btn.backgroundColor = HexColor(0xf5f5f5);
            [btn setCornerRadiusWithRadius:4 isMasks:YES];
            [[btn addTag]subscribeNext:^(id  _Nullable x) {
                NSInteger index= self.indexPath.row*3;
                NSArray *arr = kUSER_Filtrate_MANAGER.arrAttribute[0].child[self.indexPath.section].data;
                Seach_FiltrateAttributeSubData_Model_WX *model = arr[index+i];
                NSLog(@"/n/n/n//n/n/n%@//n/n/n/n/n/n/",model);

                model.isSelect = !model.isSelect;
                [btn changBtnisSelect:model.isSelect];
                model.indexTbv = 0;
//                arr[index+i] chang model;
                if (model.isSelect) {
                    kUSER_Filtrate_MANAGER.arrBrandSelectAdd = model;
                }else{
                    kUSER_Filtrate_MANAGER.arrBrandSelectRem = model;
                }
                
//                kUSER_Filtrate_MANAGER.arrBrand[self.indexPath.section][index+i] = model;
                NSLog(@"/n/n/n//n/n/n%@//n/n/n/n/n/n/",kUSER_Filtrate_MANAGER.arrAttribute[0].child[self.indexPath.section].data[index+i]);
                NSLog(@"");

            }];
            [self addSubview:btn];
            [_arrBtn addObject:btn];
        }
    }
    return _arrBtn;
}


@end
